<?php

namespace app\api\validate;

use think\Validate;
/**
 *
 * 未完成
 */
class OrdersScene extends Validate
{
    protected $rule = [
        'id' => ["require","number"],
        'name' => ['require','length'=>'1,10'],
        "telephone" => ['regex'=>'/^1[3-9]{1}[0-9]{9}$/','require'],
        "province" => ['require'],
        "city" => ['require'],
        "area" => ['require'],
        "address" => ['require'],
        "goods_name" => ['require','length'=>'1,10'],
        "remark" => ['require'],
        "status" => ['number','require'],
        "num" => ['number','require'],
        "cost_price" => ['float'],
        "agency price" => ['float'],
        "sales_price" => ['float'],
        "actual_postage" => ['float'],
        "real_postage" => ['float'],
        "order_class" => ['number','require'],
        "data_state" => ['number','require'],
        "imgs" => ['require'],
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'name.require' => '客户姓名不能为空',
        'name.length' => '客户姓名长度为1-10个字符',
        'telephone.require' => '电话号码不能为空',
        'telephone.regex' => '电话号码格式不正确',
        'province.require' => '省不能为空',
        'city.require' => '市不能为空',
        'area.require' => '区不能为空',
        'address.require' => '详细地址不能为空',
        'goods_name.require' => '产品名称不能为空',
        'goods_name.length' => '产品名称长度为1-20个字符',
        'remark.require' => 'remark不能为空',
        'id.require' => '分类ID不能为空',
        'id.number' => '分类ID只能为数值',
        'num.require' => '数量不能为空',
        'num.number' => '数量只能为数值',
        'cost_price.float' => '成本价只能为数值',
        'agency_price.float' => '代理价只能为数值',
        'sales_price.float' => '销售金额只能为数值',
        'actual_postage.float' => '实收邮费只能为数值',
        'real_postage.float' => '真实邮费只能为数值',
        'data_state.number' =>'数据状态必须为数值',
        'data_state.require' =>'未设置状态',
        'status.number' =>'审核状态必须为数值',
        'status.require' =>'未设置审核状态',
    ];

    protected $scene = [
        'add'  =>  ['name','telephone','province','address','cost_price','agency_price','sales_price','actual_postage','real_postage'],
        'update'  =>  ['id','name','telephone','province','city','area','address','goods_name','remark','num','status','cost_price','agency_price','sales_price','actual_postage','real_postage'],
        'update_state' => ['id',"data_state"],
        'update_status' =>["id",'status']
    ];
}